package com.scott.ch01.student.dao;

import com.scott.ch01.student.bean.StudentBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author 黄后林
 * @version 1.0
 * @note
 * @date 2021-11-23 21:59:21
 */
@Repository
public class StudentDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public  int addStudent(StudentBean student){
        String sql="insert into student_t(name,age) values(?,?)";
        int counter =jdbcTemplate.update(sql,student.getName(),student.getAge());
        System.out.println(counter);
        return counter;

    }
}
